/**
 * LayersService.java
 *
 * Copyright (c) 2010 Prj.Manager All Rights Reserved.
 *
 * This source file may not be copied, modified or redistributed,
 * in whole or in part, in any form or for any reason, without the express
 * written consent of Prj.Manager .
 **/
package ro.prjmanager.service;



import ro.prjmanager.core.service.AbstractService;
import ro.prjmanager.core.service.Service;
import ro.prjmanager.dao.LayersDao;
import ro.prjmanager.model.Layers;

import java.util.List;

/**
 * This class is business logic for layers table
 * It manages all transaction maded to layers table
 * @author Viorel Tacliciu
 * @version 1
 **/


public class LayersService   extends AbstractService<Layers,Integer> implements Service<Layers,Integer> {



    public void create(Layers user){
        dao.create(user);
    }


    public void delete(Integer id){
        Layers delObj =new Layers();
        delObj.setId(id);
        dao.delete(delObj);
    }

    public Layers load(Integer id){
         return dao.find(id,false);
    }

    public List<Layers> listPag(int startPage,int resPerPage){
          return dao.listPag(startPage, resPerPage);
    }

    public List<Layers> listPagFilter(int startPage,int resPerPage,String filter){
          return dao.listPagFilter(startPage, resPerPage, filter);
    }

    public int no(String filter) {
        return dao.no(filter);
    }

    public void update( Layers entity) {
        Layers db=dao.find(entity.getId(),false);
        db.setName(entity.getName());
        db.setRes(entity.getRes());
        db.setSrc(entity.getSrc());
        db.setWeb(entity.getWeb());
        dao.update(db);
    }

    public List<Layers> listPag(int startPage, int resPerPage, String orderCol, boolean asc, Object... otherItems) {
        return dao.listPag(startPage, resPerPage,orderCol,asc, otherItems);
    }

    public List<Layers> list() {
        return dao.findAll();
    }

}
